# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  protect_from_forgery # See ActionController::RequestForgeryProtection for details
  
  private
 
    def current_user
        if (session[:USER_ID])
            @current_user = Utilisateur.find(session[:USER_ID])
        else
            @current_user = nil
        end
        #@current_user ||= User.find(session[:ID]) if(session[:ID])
    end
   
    def login_required
        if(! current_user)
			flash[:notice] = "MERCI DE VOUS CONNECTER"
			redirect_to ('/homes')
        end
    end

  # Scrub sensitive parameters from your log
  # filter_parameter_logging :password
end
